<?php
	session_start();
	
	$host="localhost";
	$username="root";
	$password="";
	$database="cs4400_group17";

	mysql_connect($host,$username,$password);
	@mysql_select_db($database) or die( "Unable to select database");
	
	$username = $_SESSION['userName'];
	$useremail = $_SESSION['userEmail'];
	$password = $_POST['password'];
	$realPassword = $_POST['realPassword'];
	
	$corkboardEmail = $_POST['corkboardEmail'];
	$corkboardTitle = $_POST['corkboardTitle'];
	$corkboardCategoryName = $_POST['corkboardCategoryName'];
	$corkboardLastUpdate = $_POST['corkboardLastUpdate'];
?>

<!DOCTYPE html>
<head>
</head>
<body>
	<?php 
		if($password == $realPassword){
	?>
			<form name='myform' action='ViewCorkboard.php' method='post'>
				<input type="hidden" name="corkboardEmail" value="<?php echo $corkboardEmail;?>">
				<input type="hidden" name="corkboardTitle" value="<?php echo $corkboardTitle;?>">
				<input type="hidden" name="corkboardCategoryName" value="<?php echo $corkboardCategoryName;?>">
				<input type="hidden" name="corkboardLastUpdate" value="<?php echo $corkboardLastUpdate;?>">
				<script language="JavaScript">document.myform.submit();</script>		
			</form>
		<?php
		} else {
	?>
			Wrong Password!
			<form name='myform' action='CheckPrivatePassword.php' method='post'>
				<input type="hidden" name="corkboardEmail" value="<?php echo $corkboardEmail;?>">
				<input type="hidden" name="corkboardTitle" value="<?php echo $corkboardTitle;?>">
				<input type="hidden" name="corkboardCategoryName" value="<?php echo $corkboardCategoryName;?>">
				<input type="hidden" name="corkboardLastUpdate" value="<?php echo $corkboardLastUpdate;?>">
				<input type="hidden" name="realPassword" value="<?php echo $realPassword;?>">
				<input type='text' name='password'>
				<input type='submit' value='Try Again'>
			</form>
			<br>
			<form name = "input" action = "home.php" method = "post">
				<input type="submit" value="Back to Home" name="backtohome"/>
			</form>
	<?php 
	}
	?>
</body>
</html>